DEVICE EANPOS

0.1 Introduction

The internal device EANPOS is a tool that resides in the CPU that allows to manage the movement of a mechanical axis with a trapezoidal ramps with analog to trapezoidal or “S” ramp.
The main function of the device is to generate a trajectory or “speed profile” that, suitably converted into a proportional voltage signal, He commands a driving and then the axis attached to it, to bring it to the desired position.
The device also includes a feed-back process on the measurement taken from the transducer. This measure appropriately compared is used to generate the feedback.
The control voltage for operation is generated by a DAC hardware (Digital to Analogic Converter) present on the BUS QMOVE.
To sync the device with the actual axis position returned by, is there a special procedure for handling called “searching for presets”.
The feed-back is of PID+FF type (proportional, integral, derivative and feed-forward).


0.2 Installation

0.2.1 Device declaration in the configuration file (.CNF)

In the configuration file (.CNF), the BUS section must be declared so that you have the hardware resources required for the implementation of the EANPOS device. There must be at least a bi-directional counter and a 16-bit resolution analog output. The device can also be used with an input and an interrupt line for preset search functions.
In the INTDEVICE section of the .CNF file tmust be add the following definition:

;---------------------------------
; Internal device declaration
;---------------------------------
INTDEVICE
..
<device_name> EANPOS TCamp ICont IntL IAZero IoutA

where:

<device name>The name assigned to the device
EANPOSKeyword that identifies the analog positioner device
TCampSample time device (1÷255 ms)
IContBidirectional counter input (to prevent the device uses this resource enter the characters X.X)
IntLNumber of the interrupt line dedicated to the encoder zero pulse during the research phase of presets. Allowed values: 1÷8 (to prevent the device uses this resource, enter the character X)
IAZeroEnable input for transducer zero pulse acquisition during the research phase of presets (to prevent the device uses this resource enter the characters X.X)
IOutAHardware address of the DAC from analog output (to prevent the device uses this resource enter the characters X.X)

N.B. It is necessary that each definition are present on the same line. In case you do not want to assign a resource, for example IAZero, you must enter in the appropriate field the string X.X.

0.2.2 Example

;---------------------------------
; Internal device declaration
;---------------------------------
INTDEVICE
Axis_X EANPOS 2 2.CNT02 3 3.INP01 3.AN01

0.3 Operation

0.3.1 Position detection

The EANPOS device cquires the position of via bi-directional transmitter signals; these signals are used by an internal counter. This counter value does not express the position of the axis directly measured in the units that are required by your application. The device does not have within it the cntratio parameter, but let the installer can work with unfinished encoder resolutions by setting the data as space covered in a round encoder (measure) and number of pulses round of encoder (pulse). The relationship between the measure and pulse is the encoder resolution and must have values between 1 and 0.000935.

0.3.2 Definitions

1) The parameter measure is placed in units without decimal points (for example 100.0 mm is inserted 1000 tenths of a millimeter).
2) The pulse parameter is put into bit encoder x 4 (for example if I connected a 1024 pulses round encoder, is inserted 4096, If the measure is calculated on a round encoder).

0.3.3 Decimal point

If for the selected unit of measure is also provided for the presence of a decimal point, the locations must be represented as an integer and represent space in units without decimal point. The resolution must be calculated with the same formula and measure represent the size without decimal point. The decimal point will then be inserted into the representation of the value-time viewers (example as properties in the terminal operator).

0.3.4 Speed

The speeds are always expressed in whole units of measure in the unit of choice time. From this it emerges that the device must know the location of the decimal point of the unit of measure and this is done with the decpt parameter. This parameter can take values 0÷3.
N.B. To activate this device send the INIT command.

0.3.4.1 Example:

You have to control a rotating table that have the accuracy of 0,1° having an encoder from 1024 pulse for rown directly; you will set the following values:
Axis:measure = 3600
Axis:pulse = 4096
Axis:decpt = 1

To execute the positioning at 4.6 degrees you need to enter:
Axis:setpos = 146

To set a speed of 10 degrees degrees per second, you must type:
Axis:unitvel = 1
Axis:setvel = 10

0.4 Commands and parameters

0.4.1 Symbols used

The name of parameter, state or command are shown to the left of the table.

R
Indicates if its parameter os state is retentive (upon initialization of the device maintains the previously defined), or the state assumes upon initialization of the device.
If the device does not need to initialize the field “R” indicates the value that the parameter or state take to the power up of the card.
R = Retentive
0 = Upon initialization of the device the value is forced to zero.
1 = Upon initialization of the device the value is forced to one.
- = Upon initialization of the device is presented significant value.

D
Indicates the size of the parameter.
F = Flag
B = Byte
W = Word
L = Long
S = Single Float

0.4.1.1 Conditions

Describes all the conditions necessary so that the parameter is considered correct or because the command is accepted.
In some cases, limit values are specified for the acceptance of the parameter: if are introduced the value outside the limits set, the data is however accepted; therefore appropriate controls of the application must be provided to ensure the proper functioning.
To run a command, all conditions must be met; otherwise the command does not run.

A
Indicates the access mode.
R = Read.
W = Write.
RW = Read / Write.

0.4.2 Main controls

0.4.2.1 START

At the START command, the axis is positioned to the declared quota in the setpos variable with speed set in setvel; the placement will run using the acceleration ramp set in tacc parameter and the deceleration ramp in tdec parameter. The type of used ramp (trapezoidal or epicicloidal) is inserted in the ramptype parameter.

0.4.2.2 STOP

If during placement is necessary to stop the axis with a deceleration ramp, it will simply give the command to STOP and the axis decelerates to a stop with the ramp sets in the tdec parameter.

0.4.2.3 EMRG

This command puts the axis in emergency conditions; the st_emrg state is set to one. If the emergency command is sent to the axis during a placement, the movement is interrupted without deceleration ramp, the analog output will be set to zero volts and you dropped the reaction of space. With st_emrg = 1 (emergency condition), you cannot move the axis.

0.4.2.4 RESUME

This command will reset the emergency condition; the axis comes in reaction to space and waits for a command to be able to move (does not automatically resume interrupted positioning).

0.4.2.5 LOOPOFF

The LOOPOFF command removes the reaction of space without stopping the axis. With st_loopon = 0 the axis handling axis commands accepted, but all placements will be performed without reaction of space.
A placement made reaction without loop is comparable to a positioning run without proportional gain (is not guaranteed to arrive in position).

0.4.2.6 LOOPON

The LOOPON command closes the space feedback without stopping the axis. With st_loopon = 1 the axis is moved using all the features of the P.I.D. control.
Following is a table summarizing the conditions necessary for the axis in reaction to space and to perform placements.

LooponEmrgSpace reactionPossibility of movement
YesNoYesYes
YesYesNoNo
NoNoNoYes
NoYesNoNo

0.4.3 Description of the epicicloidal motion

The epicicloidal motion (ramptype = 1) is used to move the axes without sudden variations in speed. The time of positioning of the axis with trapezoidal ramps is less than the same axis moved with the epicicloidal ramps, but the mechanical wear is considerably higher.
For comparison shows the difference of the time of acceleration in the two cases with constant maximum gradient acceleration.

The same goes for the deceleration ramp.
The epicicloidal movement has the ability to behave in different ways in the event of a reduction in profile (rtype) and in the case of stop during acceleration (stopt).

0.4.4 Profile reduction

In the event that ramptype = 1. In case the space ahead is less than that which allows to reach the speed set by the acceleration and deceleration ramps, you pass in the phase called “reduction of profile”.
You can remain fixed the ramp time, decreasing gradients of the ramps and the speed in proportion (rtype parameter set to 0).

The profile reduction is used only if you are doing a placement.

You can also decrease the time of the ramps while maintaining the gradient of constant acceleration and decrease speed in proportion (rtype parameter set to 1).

With rtype parameter set to 0 extend considerably the time needed to placements with loss of productivity of the machine, instead of setting it to 1 in case of short placements, shorter times, but keeping the constant gradient you lose the beneficial effect of epicicloidal baseline.

0.4.5 Type of stop during the acceleration ramp

In the event that ramptype = 1 and we should curb the axis during acceleration with the STOP command, You must choose whether to complete the ramp, or if you want to abort the ramp and consequently change the epicicloid.
In case you set the stopt parameter to 0 is first completed the acceleration ramp and then performed the deceleration ramp.

The type of stop during the rumps is only used if you are doing a placement.

In case you set the stopt parameter to 1 stops the acceleration ramp and started immediately the deceleration ramp set.

You immediately notice that there is a substantial difference between the setting of stopt to 0 or to 1. To make the choice of what type of stop use, It should be noted that in case of emergency exists the emergency command that instantly locks and without ramp positioning.

0.4.6 Analogue output calibration

:important: Before starting the placements you must make sure that electrical connections and mechanical appliances do not cause malfunctions.

For axis management, the EANPOS device using an analog output with range ±10 V and resolution 16 bit with sign; with this calibration function with analog output can be driven with a constant value in order to test links and functionality.

0.4.6.1 Preliminary motion

0.4.6.2 Output settings

The EANPOS device raises the voltage value of the analogue output on the basis of a ratio between the maximum speed of the axis and the maximum output voltage. Proportionality is obtained with the maxvel parameter, that represents the speed of the axis on the analog voltage (10 V). The axle must behave symmetrical behavior respect to zero value of analog output, therefore the speed must be the same on both the positive and negative voltage at maximum.
Before you determine the value of the maximum speed, we must establish the unit of time to use for the representation of the speed in the device; the unitvel parameter defines the unit of time of the speed (Um/min or Um/s).

0.4.6.3 Theoretical method for the determination of the maximum speed.

The theoretical method is a calculation that was performed on the basis of the maximum speed of the motor. Once established the maximum revolutions per minute declared on the motor, we get the maximum speed.
Introduce in the maxvel parameter the value of maximum speed calculated.

0.4.6.4 Practical method for determining the maximum speed.

The practical approach is based on the reading of the speed detected by the device in the vel variable, giving the drive a known voltage. To provide the voltage to drive the device should be placed in a position of calibration as described in the previous paragraph. If the system permits, supply the 10V voltage to the drive and read the speed value in the vel parameter. If, on the other hand, is an excerpt of the output voltage (1, 2, … 5 V), calculate the maximum speed with the proportion: vout : 10 [V] = vel : maxvel

Enter the maximum speed value found in maxvel parameter.

0.4.7 Movement

:important:Attention! Before to move the axis, check the correct function of emergency and protection devices.

The procedures described here have allowed us to complete the first phase of device parameterizing. Now you can run a simple movement of the axis.

This first movement was done without speed feedback space. The placement may have been executed with some error introduced by the non-linearity of the components or by an imperfection in the calibration of the maximum speed. Subsequently enabling feedback space this error goes away.

0.4.8 PID+FF calibration

The runs placement in the preceding paragraph has been made without considering any position errors. To check the correct position of the axis continuously and automatically, You must have a feed-back on the position; for this reason introduces the PID+FF control algorithm including proportional, integral, derivative actions and feed-forward; the value of the analog output is given by the summation of the feed-forward, proportional, integrative e derivative actions.
Without going into the merits of a technical description of the theory of regulation, in this section describes a series of actions to adjust the parameters that affect this control. In order to achieve a satisfactory adjustment is sufficient to use only the feedforward and proportional actions; integral and derivative actions are used only for adjustments under special conditions.

0.4.8.1 Feed forward action

The feed-forward helps make the system more ready on placements, by providing the analog output voltage proportional to the theoretical speed of positioning. In practice it is the component which you performed the placements of the previous chapter.
The contribution of this action can be adjusted with the feedfw parameter; this parameter is expressed as a portion of millesimal theoretical speed; so, to introduce such as 98.5% you must set 985 (thousandths).

0.4.8.2 Proportional action

This action provides an proportional output to the instantaneous axis position error. The extent of the proportional action is defined by the pgain parameter that defines the sensitivity of the system.
The pgain parameter is introduced in thousandths; the unit value of the gain (1000) provides an analog output to maximum value (10 V) concerning the maximum speed error. For maximum speed error means the space taken by axis - at the maximum speed - for the duration of the sampling time of the device.

0.4.8.3 Integral action

Integrates the position error of the system over time set in integt parameter updating the release until the error is not canceled.
The lower the integration time of the error, the faster the recovery system error, but the system can become unstable, tending to swing.

0.4.8.4 Derivative action

Anticipates the change of the motion of the system tends to eliminate the overshoot of the positioning. The entity of change is calculated over time set in derivt parameter.
More higher is the derivation time and more speed is the system in the transient error recovery, but if you enter a value that is too high the system becomes unstable, tending to fluctuate.

Searching for presets is a procedure to synchronize the count (posit parameter) with the actual position of the axis. Can be performed in 3 different ways according to the prsmode parameter.

0.4.9.1 Preliminary considerations

Once you start search presets with the PRESET command, the axis towards the position where the zero pulse enable input transducer with speed defined by prsvel. The st_prson state you turn to report the current preset. When, in its rush, the active axis this input, reverses direction and starts with speed sprsvel.
At this point the behavior depends on the manner of loading selected (Mode 0 or Mode 1).

0.4.9.2 Preset search - Mode 0

This procedure involves the movement of the axis and the use of the zero pulse enable input transducer.

To the deactivation of the zero-pulse enable trasducer input, the preset quota is loaded on the counting (parameter posit=prspos).
Next, you disable the st_prson status and active the st_prsok state to signal the end of search. This State remains active until the starting of a new presets procedure; when the system is powered this State is always zero. See picture 1.

Picture 1: preset loading using the only enabling cam.

0.4.9.3 Preset search - Mode 1

This procedure involves the movement of axis and using the zero pulse inputs and enabling zero-pulse transducer.

To the deactivation of the zero-pulse enable transducer input, enables reading of the first zero-pulse provided by the transducer and, on this signal, it loads the preset quota in counting (parameter posit = prspos). To To allow the load of the preset quota with “Mode 1”, the card which is attached to the zero-pulse translator must transmit this signal on one of the 8 hardware interrupt lines. Moreover, the device must have been defined to use the same hardware interrupt line (See definition in the file .CNF).
Subsequently, the axis place at the preset quota, it disable the st_prson status and active the st_prsok state to signal the end of search; this State remains active until the start of a new process of presets. At the power on of the system st_prsok is always to zero. See picture 2.

Picture 2: loading preset using the enable cam and zero-pulse transducer.

0.4.9.4 Search preset - Mode 2

This procedure does NOT provide for the handling of the axis and the use of the zero-pulse transducer enable input.

With this procedure, the preset search does not execute any positioning. The preset quota load command is supply is supply from the activation of the enable input zero encoder and the st_prsok state is set to one. If the input is a continuous load remains activated while, if at power up the input is already active, the first upload is executed only after its deactivation and activation.

0.5 Special functions

0.5.1 Multi axis management

In some applications you are prompted to place a large number of axes by moving a single axis at a time. The design choice falls on installing just one drive that depending on the axis to be placed electrically connects the motor interested in positioning; the transducer is always bound to its axis.
The EANPOS device allows you to control access to the DAC device using the REGON and REGOFF commands. In this way through the QCL application defines a set of device many axes to be placed; in the definition, all devices use the same DAC resource (IOutA).
Normally all devices must be in the st_regoff = 1 state so you will not have access to the DAC device. Before you start positioning, with the REGON command, the device is brought to the st_regoff = 0 state. Runs the placement and completion,the device is returned in the state of st_regoff = 1 with the REGOFF command. For no reason two devices simultaneously must be found in the st_regoff = 0 state. When the device is placed in the position of regoff, the analog output remains fixed at the last voltage value called before the REGOFF. command

0.5.2 Change quota and counting in motion

In some applications you are prompted to define the target quota during placement, according to external events to the device. This means you can also write to the setpos parameter with placements occurring.

Changing the quota is accepted only if the new location is accessible by the management. When using the epicicloidal ramps the change quota is not accepted if st_dec = 1

When positioning you can also change the value of the posit count. This function is usually used when a device must, under special conditions, continue a speed profile for a very long time, that exceeds the time axis takes to reach the limit quota (maxpos or minpos).

0.5.3 Change speed and moving ramp time

When positioning it is possible to vary the speed of the axis without affecting the location to get to. This operation can lead an increase or a decrease of the speed, even more points with the same placement. This is accomplished with new writing in the setvel parameter. The speed change is always available except during the deceleration ramp indicated by the state (st_dec = 1)

During the placement can be varied even acceleration/deceleration times. For example, the device can start a placement with a long ramp, once you reach the target speed, has varied the tacc parameter and run a speed change with a more long ramp.
For special applications and trapezoidal ramps, ramp time can be varied even during a speed change, in this case the new time is put into execution immediately.

0.5.4 Delta count

The changing to the value of resolution (cntratio) or the writing of the posit variable, causes the reset of the remnants of the conversion.

The device always shows the absolute position of the axis; for execute the incremental positioning you must have a tool to subtract or add some value to the count (posit) without introducing errors. The count change can also execute with a direct writing to the new value in the posit parameter.
Wanting to steal 100 units of measure from the count you can:
Axis:posit = Axis:posit - 100
This introduces an error because it imposes the location “posit = -100”, when the axis could have an intermediate position between a unit of measurement and subsequent (example 100.3). This fraction (0.3) is lost and the repetition of these steps will the accumulation of a considerable error.
The DELCNT command sum the count an amount equal to the parameter delta without losing the fraction part of the position:
Axis:delta = -100 DELCNT Axis
The DELCNT command may be sent only with stopped axis (st_still=1)

0.5.4.1 Example

The reading the position of the axis is 2 units and it is located at point A. You want to add to the count posit three units.
With the instructions:
Axis:posit = Axis:posit + 2
the axis takes the new position B.
With the instructions:
Axis:delta = 2
DELCNT Axis
C position is reached.

Note that with the first instructions the axis took a delta less than 3 units and then introduced an error.
If you need to send DELCNT commands in succession, It is convenient to calculate the magnitude to be summed and send once the command; otherwise beware not to send subsequent commands without a read statement on device parameter.

0.5.4.2 Example

Axis:delta = 3
DELCNT Axis
WAIT Axis:st_init
Axis:delta = 40
DELCNT Axis

0.6 Device error management

The error presence in the device is reported by the st_error state.
When st_error is equal to 1, are present on the errcode variable the type of error occurred (see the table) and in the errvalue variable an indication on the cause of the error.
If the device goes in error, to resume the working you must delete the st_error state through the RSERR command.

0.7 Device warning management

The presence of a warning system camming is signaled by the st_warning state.
Being caused by a minor event and being guaranteed in this situation, the management of the axis, the axis continues his work.
When st_warning is equal to 1, are present on the wrncode variable the type of the warning intervened (see the table) and in the wrnvalue variable an indication on the cause that resulted warning.

CodePriorityDescription
10Command not executed

To clear the st_warning status you must send the RSWRN command.

0.8 Tabella comandi e parametri

0.8.1 Simbologia adottata

Il nome del parametro, stato o comando viene riportato alla sinistra della tabella.

R
Indica se il relativo parametro o stato è ritentivo (al momento dell’inizializzazione del device mantiene lo stato precedentementedefinito), oppure lo stato che assume al momento dell’inizializzazione del device.
Se il device non necessita di inizializzazione il campo “R” indica il valore che il parametro o stato assume all’accensione della scheda.
R = Ritentivo
0 = Al momento dell’inizializzazione del device il valore viene forzato a zero.
1 = Al momento dell’inizializzazione del device il valore viene forzato a uno.
- = Al momento dell’inizializzazione del device viene presentato il valore significativo.

D
Indica la dimensione del parametro.
F = Flag
B = Byte
W = Word
L = Long
S = Single Float

0.8.1.1 Condizioni

Vengono descritte tutte le condizioni necessarie affinché il parametro sia considerato corretto o perché il comando venga accettato.
In alcuni casi vengono specificati dei valori limite per l’accettazione del parametro: se vengono introdotti dei valori esterni ai limiti impostati, il dato viene comunque accettato; pertanto devono essere previsti opportuni controlli dell’applicativo tali da garantire il corretto funzionamento.
Per l’esecuzione di un comando, tutte le relative condizioni devono necessariamente essere soddisfatte; in caso contrario il comando non viene eseguito.

A
Indica la modalità di accesso.
R = Read (lettura).
W = Write (scrittura).
RW = Read / Write.

0.8.2 Comandi

I comandi a disposizione per gestire il device sono elencati sotto in ordine di priorità decrescente. Il device esegue tutti i comandi ricevuti entro lo stesso tempo di campionamento iniziando da quello con la priorità maggiore. Per esempio se il device riceve nello stesso tempo di campionamento i comandi CNTUNLOCK e CNTLOCK, per primo esegue il comando CNTLOCK e poi quello di CNTUNLOCK lasciando perciò il contatore libero di contare.

NomeCondizioniDescrizione
INITst_init = 0Initialization
Comando di inizializzazione device.
Se il device non è inizializzato non vengono eseguiti i calcoli relativi all'asse e quindi rimane inattivo. All'accensione è possibile scaricare tutti i parametri in memoria;successivamente, con comando INIT l'asse sarà inizialiazzato, eseguendo i calcoli una sola volta.
Attiva lo stato st_init.
EMRGst_init = 1Emergency
Pone in emergenza l'asse interrompendo, senza rampa di decelerazione, l'eventuale posizionamento in corso. E' inoltre disabilitata la reazione di spazio dell'asse.
RESUMEst_init = 1
st_emrg = 1
Resume
Ripristino della condizione di emergenza dell'asse; viene riabilitata la reazione di spazio se disabilitata.
All'acquisizione dello start, l'asse riprende il posizionamento.
STARTst_init = 1
st_regoff = 0
st_emrg = 0
st_still = 1
Start
Comanda il posizionamento alla quota setpos e velocità setvel.
STOPst_init = 1
st_regoff = 0
st_emrg = 0
st_still = 0
Stop
Interrompe l'eventuale posizionamento in corso dell'asse. La fermata dell'asse avviene seguendo la rampa di decelerazione in uso. L'asse rimane in reazione di spazio.
LOOPONst_init = 1Loop ON
Abilita la reazione di spazio asse.
L'uscita analogica contrasta ogni azione esterna che tenti di spostare l'asse dalla posizione raggiunta (deriva, operatore, …). Queta operazione azzera l'eventuale errore di inseguimento follerr.
LOOPOFFst_init = 1Loop OFF
Disabilita la reazione di spazio asse.
L'asse può essere spostato dalla sua posizione senza che l'uscita analogica contrasti il movimento.
CNTLOCKst_init = 1Counter lock
Blocca l'acquisizione del conteggio asse anche se il trasduttore continua ad inviare i segnali. In questa fase l'eventuale spostamento dell'asse non viene rilevato.
Disabilita il caricamento della quota di preset sul conteggio.
Attiva lo stato st_cntlock
CNTUNLOCKst_init = 1Counter unlock
Sblocca il conteggio dell'asse.
Viene ripresa la lettura dei segnali inviati dal trasduttore e l'aggiornamento del conteggio.
Disattiva lo stato st_cntlock.
CNTREVst_init = 1Counter reverse
Consente di invertire le fasi del trasduttore all'interno della scheda.
Viene quindi invertito il senso del conteggio (incremento/decremento).
Attiva lo stato st_cntrev.
CNTDIRst_init = 1Counter direct
Il conteggio dell'asse non viene invertito.
Disattiva lo stato st_cntrev.
PRESETst_init = 1
st_regoff = 0
st_emrg = 0
st_cal = 0
Preset
Start ricerca preset asse.
Viene dato inizio alla procedura di ricerca di preset con le modalità impostate con i parametri prsmode e prsdir. Se la ricerca di preset è già in esecuzione, il comando esegue l'inversione del senso di ricerca.
Attiva lo stato st_prson e disattiva lo stato st_prsok.
CALONst_init = 1Calibration ON
L'uscita analogica viene impiegata come generatore di tensione; in questo caso non è possibile usarla per posizionare l'asse. Il valore in uscita è settabile a piacere tramite la variabile vout.
CALOFFst_init = 1
st_cal = 1
Calibration OFF
L'uscita analogica non viene gestita come generatore di tensione, pertanto può essere nuovamente usata per la gestione dei posizionamenti.
MANFWst_init = 1
st_regoff = 0
st_prson = 0
st_still = 1
st_cal = 0
Manual forward
Comanda il posizionamento manuale in avanti (verso maxpos) alla velocitá impostata.
Se il conteggio è maggiore di maxpos, l'asse non si sposterà
MANBWst_init = 1
st_regoff = 0
st_prson = 0
st_still = 1
st_cal = 0
Manual backward
Comanda il posizionamento manuale in indietro (verso minpos) alla velocitá impostata.
Se il conteggio è minore di minpos, l'asse non si sposterà
REGOFFst_init = 1
st_still = 1
Regulation OFF
Disabilita la regolazione e l'aggiornamento del DAC, nonché tutti i comandi di movimento
REGONst_init = 1
st_regoff = 1
Regulation ON
Riabilita la regolazione e l'aggiornamento del DAC, nonché tutti i comandi di movimento.
DELCNTst_init = 1
st_cal = 0
st_prson = 0
Delta counter
Il conteggio (posizione dell'asse) viene modificato sommandogli algebricamente il valore specificato nella variabile delta.
Questo comando può essere dato sempre, tranne se con l'asse in movimento il comando farebbe invertire la direzione.
Nel caso di utilizzo di rampe di decelerazione epicicloidali non è possibile dare il comando se st_dec = 1
RSERR-Reset error
Azzera lo stato st_error.
RSWRN-Reset warning
Azzera lo stato st_warning
RSPRSOK-Reset preset OK
Azzera lo stato st_prsok

0.8.3 Parametri

NomeDRACondizioniDescrizione
measureLRR-W-Measure (1÷999999)
Indica lo spazio, in unità di misura, percorso dall'asse per ottenere gli impulsi encoder * 4 impostati nel parametro pulse.
Questo parametro è utilizzato per il calcolo della risoluzione dell'asse con la formula:
Risoluzione = measure* 4 / pulse
La risoluzione deve avere un valore compreso tra 0.00374 e 4.00000
pulseLRR-W-Pulse encoder (1÷999999)
Indica gli impulsi moltiplicato 4 forniti dall'encoder per ottenere lo spazio impostato nel parametro measure.
Questo parametro è utilizzato per il calcolo della risoluzione dell'asse con la formula:
Risoluzione = measure* 4 / pulse
La risoluzione deve avere un valore compreso tra 0.00374 e 4.00000 st_camex = 0 st_prson = 0
maxposLRR-Wst_still = 1Maximum position (-999999 ÷ 999999)
Definisce la massima quota raggiungibile dall'asse; il valore impostato è da considerarsi anche come limite massimo per l'introduzione delle quote di lavoro. Valore espresso in unità di misura (Um).
minposLRR-Wst_still = 1Minimum position (-999999 ÷ 999999)
Definisce la minima quota raggiungibile dall'asse; il valore impostato è da considerarsi anche come limite minimo per l'introduzione delle quote di lavoro.
Valore espresso in unità di misura (Um).
prsposLRR-Wst_still = 1
st_prson = 0
Preset position (minpos÷maxpos)
Definisce il valore che viene caricato sul conteggio con la procedura di ricerca di preset.
maxvelLRR-Wst_still = 1Maximum velocity (0 ÷ 999999)
Definisce la massima velocità dell'asse (relativa al riferimento analogico di +/-10V).
Il valore introdotto è nell'unità di tempo della velocità impostata Velocity unit. Valore espresso in Um/s o Um/min.
prsvelLRR-Wst_still = 1
st_prson = 0
Preset velocity (0 ÷ maxvel)
Definisce la velocità dell'asse durante la procedura di ricerca di preset.
Il valore introdotto è nell'unità di tempo della velocità impostata (Velocity unit).
sprsvelLRR-Wst_still = 1
st_prson = 0
Preset search velocity
Nella procedura di ricerca di preset, definisce la velocità dell'asse nella fase di acquisizione dell'impulso di zero.
Il valore introdotto è nell'unità di tempo della velocità impostata (Velocity unit).
tollLRR-W-Tolerance (-999999 ÷ 999999)
Definisce una fascia di conteggio intorno alle quote di posizionamento.
Se il posizionamento si conclude entro tale fascia, è da considerarsi corretto. Valore espresso in unità di misura (Um).
maxfollerrLRR-W-Maximum following error (0 ÷ 2147483648)
Definisce il massimo scostamento accettabile tra la posizione teorica e la posizione reale dell'asse. E' utilizzato per la gestione di st_foller. Valore espresso in bit trasduttore.
rampmodeBRR-Wse st_still = 1 scrittura sempre abilita, se st_still = 0 il nuovo valore viene memorizzato ma processato solamente se i nuovi tempi di acc.e dec. permettono di raggiungere la quota impostata.Acceleration/deceleration time mode
Utilizzato per la scelta tra rampe l'accelerazione e decelerazione uguali o differenziate.
Valori ammessi:
0 = rampe uguali,
1 = rampe differenziate.
ramptypeBRR-Wst_still = 1Ramp type
Definisce il tipo di rampa da eseguire:
0 = Accelerazione e decelerazione di tipo trapezoidale,
1 = Accelerazione e decelerazione di tipo epicicloidale,
2 = Accelerazione di tipo trapezoidale e decelerazione di tipo epicicloidale,
3 = Accelerazione di tipo epicicloidale e decelerazione di tipo trapezoidale.
taccdecWRR-Wse st_still = 1 scrittura sempre abilita, se st_still = 0 il nuovo valore viene memorizzato ma processato solamente se il nuovo tempo permette di raggiungere la quota impostata.Acceleration/deceleration time (da 0 a 999)
É il tempo necessario per passare da velocità 0 a velocità massima e viceversa; il parametro è utilizzato se rampmode = 0. Valore espresso in centesimi di secondo.
taccWRR-Wse st_still = 1 scrittura sempre abilita, se st_still = 0 il nuovo valore viene memorizzato ma processato solamente se il nuovo tempo permette di raggiungere la quota impostata.Acceleration time (da 0 a 999)
Definisce il tempo necessario all'asse per accelerare da zero (condizione di asse fermo) alla velocità massima. Valore espresso in centesimi di secondo.
tdecWRR-Wse st_still = 1 scrittura sempre abilita, se st_still = 0 il nuovo valore viene memorizzato ma processato solamente se il nuovo tempo permette di raggiungere la quota impostata.Deceleration time (da 0 a 999)
Definisce il tempo necessario all'asse per decelerare dalla velocità massima a zero (condizione di asse fermo). Valore espresso in centesimi di secondo.
rtypeBRR-Wramptype=1Reduction type
Tipo di riduzione del profilo nel caso in cui lo spazio da percorrere non permetta di eseguire completamente le rampe di accelerazione e decelerazione.
0= Tempo delle rampe fisso con riduzione della pendenza,
1= Pendenza fissa con riduzione del tempo delle rampe.
StoptBRR-Wramptype=1Stop type
Tipo di stop durante le rampe di accelerazione
0 = La rampa di accelerazione viene conclusa e quindi si inizia la rampa di decelerazione,
1= La rampa di accelerazione viene interrotta ed inizia subito la rampa di decelerazione di tipo epicicloidale.
tinvWRR-W-Direction inversion delay (da 0 a 999)
Viene utilizzato per evitare stress meccanici dovuti a troppo rapide inversioni del senso di movimento. Valore espresso in centesimi di secondo.
toldlyWRR-W-Tolerance delay (da 0 a 999)
Definisce il tempo che intercorre tra l'arrivo dell'asse nella fascia di tolleranza e la relativa segnalazione di stato. Valore espresso in centesimi di secondo.
pgainWRR-W-Proportional gain (da 0 a 32767)
Impostando il valore 1000, il coefficiente è 1.000.
È il coefficiente che moltiplicato per l'errore di inseguimento genera la parte proporzionale dell'uscita di regolazione.
feedfwWRR-W-Feed forward (da 0 a 32767)
Impostando il valore 1000, la percentuale è del 100%.
È il coefficiente percentuale che, moltiplicato per la velocità, genera la parte feed-forward dell'uscita di regolazione.
integtWRR-W-Integral time (da 0 a 32767)
È il tempo, espresso in millisecondi, che produce il coefficiente d'integrazione dell'errore di inseguimento. L'integrazione di tale errore moltiplicata per tale coefficiente genera la parte integrale dell'uscita di regolazione.
derivtWRR-W-Derivative time (da 0 a 32767)
È il tempo, espresso in millisecondi, che produce il coefficiente derivativo dell'errore di inseguimento. La derivazione di tal errore moltiplicata per tale coefficiente genera la parte derivativa dell'uscita di regolazione.
prsmodeWRR-Wst_prson = 0Preset mode
Definisce il tipo di ricerca di preset:
0= Per la ricerca dell'abilitazione impulso di zero, l'asse inizia il movimento in veloce, incontra la camma di abilitazione, inverte la direzione rallentando e, sul fronte di discesa relativo al segnale di camma, carica la quota di preset.
1= Per la ricerca dell'abilitazione impulso di zero, l'asse inizia il movimento in veloce, incontra la camma di abilitazione, inverte la direzione ed in lento acquisisce il primo impulso di zero (dopo la disattivazione del segnale di camma),
2= Non viene attivata la procedura di ricerca preset con movimentazione dell'asse. Il conteggio viene aggiornato alla quota di preset all'attivazione dell'abilitazione impulso di zero.
prsdirBRR-Wst_prson = 0Preset direction
Definisce la direzione del movimento asse per la ricerca della camma di abilitazione impulso di zero.
0 = l'asse si dirige in avanti,
1 = l'asse si dirige indietro.
unitvelBRR-Wst_still = 1Velocityc unit
Definisce se l'unità di tempo della velocità è espressa in minuti o secondi.
0 = Um/min,
1 = Um/sec.
decptBRR-Wst_still = 1Decimal point (0 ÷ 3)
Definisce la precisione con la quale si intendono impostare le preselezioni e visualizzare i conteggi relativamente all'asse.
offsetWRR-W-Offset (-32768 ÷ 32767)
Offset uscita DAC in bit.
Definisce il valore in bit della correzione relativa all'uscita analogica in modo da compensare l'eventuale deriva del sistema. Valore espresso in bit DAC.
setposLRR-WSe st_still = 0, vedi condizioni nel paragrafo “Funzioni speciali - cambio quote e conteggi in movimento”Setted position (minpos ÷ maxpos)
Definisce la quota di posizionamento raggiungibile dall'asse alla velocità setvel.
N.B. Il valore è alterato se si comanda una procedura di ricerca preset con prsmode = 0 o 1.
setvelLRR-WSe st_still = 0, vedi condizioni nel paragrafo “Funzioni speciali - cambio velocità tempo di rampa in movimento”Setted velocity (0 ÷ maxvel) É il valore della velocità di posizionamento. Valore espresso in Um/s o Um/min.
N.B. Il valore viene alterato se si comanda una procedura di ricerca preset con prsmode = 0 o 1.
voutB0R-Wst_cal = 1Volt out (-100 ÷ 100)
É il valore della tensione d'uscita, espressa in decimi di volts, da usare nella procedura di calibrazione.
velL0R-W-Velocity
É il valore della velocità istantanea dell'asse. L'aggiornamento viene eseguito ogni 250 millisecondi.
Valore espresso in Um/s o Um/min.
frqL0R-W-Frequency
É il valore della frequenza istantanea dell'asse. L'aggiornamento è eseguito ogni 250 millisecondi.
Valore espresso in Hz.
positLRR-WSe st_still = 0, vedi condizioni nel paragrafo dedicatoActual position
É il valore della posizione istantanea dell'asse.
Valore espresso in unità di misura (Um).
encoderLRR-Encoder
É il valore della posizione istantanea dell'asse. Valore espresso in bit encoder * 4.
follerrL0R-Following error
É il valore istantaneo dell'errore d'inseguimento. Valore espresso in bit trasduttore.
ffwdregL0R-Feed-forward register
È il valore istantaneo del registro di feed-forward espresso in bit.
propregL0R-Proportional register
È il valore istantaneo del registro proporzionale espresso in bit.
intregL0R-Integral register
È il valore istantaneo del registro integrale espresso in bit.
derregL0R-Derivative register
È il valore istantaneo del registro derivativo espresso in bit.
deltaL0R-W-Delta counter (-999999 ÷ 999999)
È il valore che è sommato al conteggio quando viene inviato un comando DELCNT. Valore espresso in unità di misura (Um).
errcodeB0R-Error code (0 ÷ 100)
Indica il tipo d'errore intervenuto nel sistema.
Il codice è valido solo se st_error = 1 (Vedi capitolo dedicato).
errvalueB0R-Error value (0 ÷ 100)
Indica la causa dell'errore intervenuto nel sistema. Il codice è valido solo se st_error = 1 (Vedi capitolo dedicato)
wrncodeB0R-Warning code (0 ÷ 100)
Indica il tipo di warning intervenuto nel sistema. Il codice è valido solo se st_warning = 1 (Vedi capitolo dedicato)
wrnvalueB0R-Warning value (0 ÷ 100)
Indica la causa del warning intervenuto nel sistema. Il codice è valido solo se st_warning = 1 (Vedi capitolo dedicato)

0.8.4 Stati

NomeDRACondizioniDescrizione
st_initF0R-Initialization
Segnalazione di device inizializzato.
0 = device non inizializzato,
1 = device inizializzato.
All'accensione per default viene caricato il valore zero.
st_emrgF0R-Emergency
Segnalazione d'asse in emergenza.
0 = asse non in emergenza,
1 = asse in emergenza.
st_tollF0R-Tolerance
Segnalazione d'asse in tolleranza rispetto alla quota posta in esecuzione dal comando di START. La segnalazione d'asse in tolleranza può essere ritardata tramite il parametro toldly.
0 = asse non in tolleranza,
1 = asse in tolleranza.
All'accensione per default viene caricato il valore zero.
st_prsokF0R-Preset Ok
Segnalazione di ricerca di preset conclusa correttamente.
0 = preset non effettuato o non concluso correttamente,
1 = preset effettuato e concluso correttamente.
All'accensione per default viene caricato il valore zero.
st_stillF0R-Still
Segnalazione d'asse fermo.
0 = asse in movimento,
1 = asse fermo.
All'accensione per default viene caricato il valore 1.
st_prsonF0R-Preset ON
Segnalazione di ricerca di preset asse in corso.
0 = ricerca di preset non in corso,
1 = ricerca di prest in corso.
All'accensione per default viene caricato il valore zero.
st_movdirF0R-Movement direction
Segnalazione della direzione del movimento.
0 = avanti,
1 = indietro.
All'accensione per default viene caricato il valore zero.
st_looponF0R-Loop ON
Segnalazione d'asse in reazione di spazio.
0 = asse non in reazione di spazio,
1 = asse in reazione di spazio.
All'accensione per default viene caricato il valore zero.
st_follerF0R-Following error
Segnalazione d'asse in errore d'inseguimento (ritenuta 500 ms).
0 = asse non in errore d'inseguimento,
1 = asse in errore d'inseguimento.
All'accensione per default viene caricato il valore 1.
st_regoffF0R-Regulation
Segnala che la regolazione é disabilitata e che l'aggiornamento del DAC non viene effettuato.
st_calF0R-Calibration
Segnalazione di device come generatore di tensione.
0=generatore di tensione asse disattivo,
1=generatore di tensione asse attivo.
All'accensione per default viene caricato il valore zero.
st_cntlockF0R-Counter locked
Segnalazione d'asse sbloccato.
0=conteggio asse sbloccato,
1=conteggio asse bloccato.
st_cntrevF0R-Counter reversed
Segnalazione di conteggio asse invertito.
0=Conteggio asse non invertito,
1=Conteggio asse invertito.
All'accensione viene mantenuto lo stato presente allo spegnimento.
st_accF0R-Acceleration
Segnalazione d'asse in fase di accelerazione.
0=asse non in accelerazione,
1=asse in accelerazione.
All'accensione per default viene caricato il valore zero.
st_decF0R-Deceleration
Segnalazione d'asse in fase di decelerazione.
0=asse non in decelerazione,
1=asse in decelerazione.
All'accensione per default viene caricato il valore zero.
st_vconstF0R-Costant speed
Segnalazione d'asse in fase di velocità costante.
0 =asse non in velocità costante,
1 =asse in velocità costante.
All'accensione per default viene caricato il valore zero.
st_errorF0R-Status of device error
Indica lo stato d'errore nel device.
Per la decodifica dell'errore si deve fare riferimento alla variabile errcode ed errvalue.
0 = Errore non presente,
1 = Errore presente.
All'accensione per default è posto a zero.
st_warningF0R-Status of device warning
Indica lo stato di warning nel device.
Per la decodifica del warning si deve fare riferimento alla variabile wrncode e wrnvalue.
0 = Warning non presente,
1 = Warning presente.
All'accensione per default è posto a zero.
st_intF0R-Status of interrupt line
Indica lo stato della linea d'interrupt.
0 = Ingresso in interrupt disattivo,
1 = Ingresso in interrupt attivo.
All'accensione per default è posto a zero.

0.9 Limitazioni

Nessuna limitazione.

0.10 Esempio applicativo

0.10.1 File di configurazione

;*************************************************************************************
; Nome Modulo:            Ex_Eanpos.CNF Progetto: Ex_EANPOS
; Autore:                 QEM srl Data: 01/05/99
; Sistema:                QMove1 / QCL3 Libreria: 1LIB4001
; Funzionalità:           Esempio gestione EANPOS Release: 0
;------------------------------------- Note ------------------------------------------
; [1] - Applicativo d'esempio per utilizzo device EANPOS
  **************************************************************************************
;-------------------------------------------------------------------------------------
; Definizione Costanti
;-------------------------------------------------------------------------------------
CONST
;-------------------------------------------------------------------------------------
; Definizione Variabili SYSTEM
;-------------------------------------------------------------------------------------
SYSTEM
slQuotaPos L              ;Variabile per quota di posizionamento
slVelAsse L               ;Variabile per velocità asse
 
;-------------------------------------------------------------------------------------;
Definizione Variabili GLOBAL
;-------------------------------------------------------------------------------------
GLOBAL
gfMovMan F                ;Flag segnalazione movimenti
                          ;manuali in corso
gfMovAuto F               ;Flag segnalazione movimenti
                          ;automatici in corso
;-------------------------------------------------------------------------------------
; Definizione Variabili TIMER
;-------------------------------------------------------------------------------------
TIMER
;-------------------------------------------------------------------------------------
; Definizione DATAGROUP
;-------------------------------------------------------------------------------------
;DATAGROUP
 
;------------------------------------------------------------------------------------- ;
Configurazione Bus
;-------------------------------------------------------------------------------------
BUS
      1     1CPUD 01
      2     1MIXA 00
      3     .
      4     .
;-------------------------------------------------------------------------------------
; Definizione Variabili INPUT
;-------------------------------------------------------------------------------------
INPUT
ifAvMan     F     2.INP01    ;Ingresso di avanti manuale
ifInMan     F     2.INP02    ;Ingresso di indietro manuale
ifStart     F     2.INP03    ;Ingresso di START asse
ifStop      F     2.INP04    ;Ingresso di STOP asse
;-------------------------------------------------------------------------------------
; Definizione Variabili OUTPUT
;-------------------------------------------------------------------------------------
OUTPUT
ofToll      F     2.OUT01    ;Uscita di asse in tolleranza
ofAxeFermo  F     2.OUT02    ;Uscita di asse fermo
;-------------------------------------------------------------------------------------
; Dichiarazione device interni
;-------------------------------------------------------------------------------------
INTDEVICE
;Nome      Tipo   TCamp      Contatore      Inter      AbilZero     OutAnal
Asse       EANPOS 0004       2.CNT01        1          2.INP01      2.AN01
 
END

0.10.2 Gestione EANPOS

;*************************************************************************************
;    Nome File  : TASK_00.MOD
;    Progetto   : EX_EANPOS
;    Descrizione: Gestione Posizionamento
;*************************************************************************************
 
;-------------------------------------------------------------------------------------
; Operazioni di Inizializzazione Asse
;-------------------------------------------------------------------------------------
Asse:measure = 10000                     ;Spazio in 1 giro encoder(Um)
Asse:pulse = 40000                       ;impulsi giro encoder
Asse:maxvel = 100000                     ;Velocita` max. = Velocità Asse con
                                         ;uscita analogica a 10V (CALON/vout=100)
Asse:maxpos = 999999                     ;Quota massima
Asse:minpos = -999999                    ;Quota minima
Asse:maxfollerr = 10000                  ;Errore di inseguimento
Asse:unitvel = 0                         ;Unita di tempo della velocità
Asse:decpt = 0                           ;Cifre decimali
Asse:rampmode = 0                        ;Tipo di rampe utilizzate
Asse:taccdec = 100                       ;Tempo di accelerazione e di decelerazione
Asse:tacc = 0                            ;Tempo di accelerazione (non utilizzato)
Asse:tdec = 0                            ;Tempo di decelerazione (non utilizzato)
Asse:tinv = 0                            ;Tempo di inversione asse
Asse:toll = 5                            ;Tolleranza
Asse:toldly = 10                         ;Tempo di ritardo attivaz. tolleranza
Asse:prsmode = 0                         ;Tipo di ricerca di preset
Asse:prspos = 0                          ;Quota di preset
Asse:prsdir = 0                          ;Direzione della ricerca di preset
Asse:prsvel = (20 * Asse:maxvel)/100     ;Velocità di preset (20% della vel.max.)
Asse:sprsvel = (10 * Asse:maxvel)/100    ;Velocità di ricerca impulso di
                                         ;zero (10% della vel.max.)
Asse:offset = 0                          ;Tensione di offset
Asse:pgain = 10                          ;Guadagno proporzionale
Asse:feedfw = 1000                       ;Feedforward
Asse:integt = 0                          ;Tempo di integrale
Asse:derivt = 0                          ;Tempo derivativo
INIT Asse                                ;Inizializza il device
WAIT Asse:st_init                        ;Attendi che il device sia inizializzato
CNTUNLOCK Asse                           ;Sblocca conteggio
WAIT NOT Asse:st_cntlock                 ;Attendi che il conteggio sia sbloccato
CNTDIR Asse                              ;Imposta il senso del conteggio
WAIT NOT Asse:st_cntrev                  ;Attendi che sia impostato il senso
                                         ;del conteggio
REGON Asse                               ;Abilita la regolazione
WAIT NOT Asse:st_regoff                  ;Attendi l'abilitazione alla regolazione RESUME Asse
                                         ;Togli l'asse dallo stato di emergenza
WAIT NOT Asse:st_emrg                    ;Attendi che l'asse non sia in emergenza
LOOPON Asse                              ;Aggancia loop di reazione dell'asse
WAIT Asse:st_loopon                      ;Attendi che sia agganciato il loop di
                                         ;reazione dell'asse
IF (slVelAsse EQ 0)                      ;Nel caso in cui il set di velocità
                                         ;dell'asse sia zero
slVelAsse = 50                           ;Imposta una velocità di posizionamento
ENDIF
IF (slQuotaPos EQ 0)                     ;Nel caso in cui la quota di
                                         ;posizionamento dell'asse sia zero
slQuotaPos = 2000                        ;Imposta una quota di posizionamento
ENDIF
 
;-------------------------------------------------------------------------------------
;     Operazioni di Posizionamento
;-------------------------------------------------------------------------------------
;     ------------------------------- variabili utilizzate ------------------------------
;     slVelAsse: Variabile impostabile che rappresenta la velocità dell'asse
; (espressa in % della vel.max.)
;     slQuotaPos: Variabile impostabile che rappresenta la quota di posizionamento dell'asse
; ---------------------------------- flag utilizzati --------------------------------
;     gfMovMan: movimento manuale in corso
;     gfMovAuto: Movimento automatico in corso
;-------------------------------------------------------------------------------------
MAIN:
;-------------------------------------------------------------------------------------
;     Gestione uscite
;-------------------------------------------------------------------------------------
ofToll = Asse:st_toll                       ;Imposto l'uscita di tolleranza come
                                            ;lo stato di tolleranza
ofAxeFermo = Asse:st_still                  ;Imposto l'uscita di asse fermo come
                                            ;lo stato di asse fermo
 
;-------------------------------------------------------------------------------------
; Gestione movimenti automatici
;-------------------------------------------------------------------------------------
IF ifStart                                  ;Attende l'ingresso di START
  IF NOT gfMovMan                             ;Controlla che non ci siano movimenti manuali
    IF Asse:st_still                            ;Controlla che l'asse sia fermo
      Asse:setvel=(slVelAsse*Asse:maxvel)/100     ;Imposta la velocità dell'asse
      Asse:setpos = slQuotaPos                    ;Imposta la quota di posizionamento
      START Asse                                  ;Esegue lo start dell'asse
      gfMovAuto = 1                               ;Segnala movimento automatico in corso
    ENDIF
  ENDIF
ENDIF
IF ifStop                                   ;Attende l'ingresso di STOP
  IF NOT Asse:st_still                        ;Controlla che l'asse NON sia fermo
    STOP Asse                                   ;Esegue lo stop dell'asse
  ENDIF
ENDIF
IF gfMovAuto                                ;Controlla segnalazione movimento
  ;automatico in corso
  IF Asse:st_still                            ;Controlla che l'asse sia fermo
    gfMovAuto = 0                               ;Resetta stato di movimento Automatico
  ENDIF
ENDIF
 
;-------------------------------------------------------------------------------------
;    Gestione movimenti manuali
;-------------------------------------------------------------------------------------
IF ifAvMan                                            ;Attende l'ingresso di movimento manuale
   IF NOT (gfMovAuto OR gfMovMan)                     ;Controlla che non ci siano movimenti
                                                      ;automatici o manuali
      IF Asse:st_still                                ;Controlla che l'asse sia fermo
            Asse:setvel=(slVelAsse*Asse:maxvel)/100   ;Imposta la velocita` dell'asse
                       MANFW Asse                     ;Avanti asse in manuale
                       gfMovMan = 1                   ;Segnala movimento manuale in corso
      ENDIF
   ENDIF
ENDIF
 
IF ifInMan                                            ;Attende l'ingresso di movimento manuale
   IF NOT (gfMovAuto OR gfMovMan)                     ;Controlla che non ci siano movimenti
                                                      ;automatici o manuali
      IF Asse:st_still                                ;Controlla che l'asse sia fermo
            Asse:setvel=(slVelAsse*Asse:maxvel)/100   ;Imposta la velocita` dell'asse
                       MANBW Asse                     ;Avanti asse in manuale
                       gfMovMan = 1                   ;Segnala movimento manuale in corso
      ENDIF
   ENDIF
ENDIF
 
IF gfMovMan                                           ;Se l'asse si muove in manuale
   IF NOT (ifAvMan OR ifInMan)                        ;Se gli ingressi di avanti e indietro
                                                      ;manuale sono OFF
      STOP Asse                                       ;Ferma l'asse
      gfMovMan = 0                                    ;Togli la segnalazione di asse in
                                                      ;movimento manuale
   ENDIF
ENDIF
 
;-------------------------------------------------------------------------------------
; Operazioni finali
;-------------------------------------------------------------------------------------
  WAIT 1
  JUMP MAIN
END